// pages/game/game.js
Page({
  // 返回上一页
  goBack() {
    wx.navigateBack();
  },

  // 跳转到游戏页面
  goToGame(e) {
    const gameType = e.currentTarget.dataset.game;
    if (gameType === 'snake') {
      wx.navigateTo({
        url: '/pages/four/four',
      });
    } else if (gameType === 'puzzle') {
      wx.navigateTo({
        url: '/pages/puzzle/puzzle',
      });
    } else if (gameType === 'candy') {
      wx.navigateTo({
        url: '/pages/candy/candy',
      });
    }else if (gameType === 'eliminate') {
      wx.navigateTo({
        url: '/pages/eliminate/eliminate',
      });
    }
    else if (gameType === 'breaklover') {
      wx.navigateTo({
        url: '/pages/breaklover/breaklover',
      });
    }
    else if (gameType === 'bottle') {
      wx.navigateTo({
        url: '/pages/bottle/bottle',
      });
    }
    else if (gameType === 'charge') {
      wx.navigateTo({
        url: '/pages/charge/charge',
      });
    }
    else if (gameType === 'paino') {
      wx.navigateTo({
        url: '/pages/paino/paino',
      });
    }
    else if (gameType === 'number') {
      wx.navigateTo({
        url: '/pages/number/number',
      });
    }

    else if (gameType === 'bike') {
      wx.navigateTo({
        url: '/pages/bike/bike',
      });
    }
     else {
      wx.navigateTo({
        url: `/pages/game-detail/game-detail?type=${gameType}`,
      });
    }
  },

  // 跳转到关于作品页面
  goToAbout() {
    wx.navigateTo({
      url: '/pages/about/about',
    });
  }
});